home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
helpcpp.exe
/
HELP.DIF
< prev
next >
Wrap
Text File
|
1992-07-13
|
3KB
|
129 lines
65a66,143
>
> /**************************************************************************
> C L A S S S T A C K
> **************************************************************************/
> #define STK_SIZE 10
> #define STK_SHIFT 5
>
> class Stack
> {
> int stk[STK_SIZE];
> int current;
> int p;
> public:
> Stack() {}
> void reset();
> void save(int v);
> void push(int v);
> int pop();
> };
>
> Stack stack;
>
> /**************************************************************************
> S T A C K : : R E S E T
> **************************************************************************/
>
> void Stack::reset()
> {
> p = 1;
> stk[0] = 0;
> current = 0;
> } /* end Stack::Stack */
>
>
> /**************************************************************************
> S T A C K : : P U S H
> **************************************************************************/
>
> void Stack::push(int v)
> {
> if (p >= STK_SIZE)
> {
> // Shift values to the left by STK_SHIFT, saving the first
> memmove(&stk[1],&stk[1+STK_SHIFT],(STK_SIZE-STK_SHIFT-1)*sizeof(int));
> p -= STK_SHIFT;
> }
> if (p > 0)
> stk[p++] = current;
> else if (current != stk[0])
> {
> stk[++p] = current;
> p++;
> }
> current = v;
> } /* end Stack::push */
>
>
> /**************************************************************************
> S T A C K : : S A V E
> **************************************************************************/
>
> void Stack::save(int v)
> {
> current = v;
> } /* end Stack::save */
>
>
> /**************************************************************************
> S T A C K : : P O P
> **************************************************************************/
>
> int Stack::pop()
> {
> if (p > 0)
> p--;
> return stk[p];
> } /* end Stack::pop */
>
78a157,158
> stack.reset();
> stack.save(context);
208d287
<
218a298
>
225a306,311
>
> case kbAltF1:
> keyRef = stack.pop();
> switchToTopic(keyRef);
> break;
>
229a316
> stack.push(keyRef);
232a320
>
237a326
>
261a351,352
> {
> stack.push(keyRef);
262a354
> }
267,271c359,375
< if ((event.message.command == cmClose) && (owner->state && sfModal != 0))
< {
< endModal(cmClose);
< clearEvent(event);
< }
---
> switch(event.message.command)
> {
> case cmClose:
> if (owner->state && sfModal != 0)
> {
> endModal(cmClose);
> clearEvent(event);
> }
> break;
>
> case cmHelp:
> keyRef = 0;
> stack.push(keyRef);
> switchToTopic(keyRef);
> clearEvent(event);
> break;
> }